package com.hh.eduservice.controller.front;

import com.hh.commonutils.Result;
import com.hh.eduservice.entity.EduTeacher;
import com.hh.eduservice.service.EduTeacherService;
import org.springframework.beans.factory.annotation.Autowired;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.springframework.web.bind.annotation.*;

import java.util.HashMap;

@RestController
@RequestMapping("eduservice/teacherfront")
public class FrontEduTeacherController {
    @Autowired
    private EduTeacherService eduTeacherService;

    @PostMapping("/getTeacherFrontList/{page}/{limit}")
    public Result getTeacherFrontList(@PathVariable long page,@PathVariable long limit){
        Page<EduTeacher> pageParam = new Page<>(page, limit);
        HashMap<String, Object> map = eduTeacherService.getLimitEduTeachers(pageParam);
        return Result.success().data(map);
    }

    @GetMapping("/getTeacherFrontInfo/{id}")
    public Result getTeacherFrontInfo(@PathVariable String id){
        Result teacherInfoAndCourses = eduTeacherService.getTeacherInfoAndCourses(id);
        return teacherInfoAndCourses;
    }
}
